package cn.com.bluemoon.daps.model.utils.wrapper;

import cn.com.bluemoon.daps.common.enums.BmStatus;
import cn.com.bluemoon.daps.model.dto.DapModelVersionInter;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

/**
 * 定义模型版本的wrapper查询条件 query lambda
 * <pre>
 *      @Test
 *     public void test_base_model_wrapper() {
 *         LambdaQueryWrapper<DapDataModelTable> queryWrapper = DapModelVersionQueryWrapper
 *                 .<DapDataModelTable>lambdaQuery().modelNewestQueryWrapper()
 *                 .last("limit 1");
 *         List<DapDataModelTable> list = tableService.list(queryWrapper);
 *         System.out.println(list.size());
 *     }
 * </pre>
 *
 * @author Jarod.Kong
 * @date 2021/3/15 13:41
 */
@Deprecated
public class DapModelVersionQueryWrapper<T extends DapModelVersionInter> {

    public static <T extends DapModelVersionInter> DapModelVersionQueryWrapper<T> lambdaQuery() {
        return new DapModelVersionQueryWrapper<T>();
    }

    public LambdaQueryWrapper<T> modelNewestQueryWrapper() {
        return Wrappers.<T>lambdaQuery()
                .eq(T::getBmStatus, BmStatus.ON)
                .eq(T::getDataNewest, 1)
                .eq(T::getPId, "0");
    }
}